import 'package:flutter/material.dart';

import '../../ble/protocol/base/SourceInterface.dart';
import '../../ble/protocol/base/SourceType.dart';
import '../../ble/protocol/iledcolor/source/gif/GifSourceBean.dart';
import '../../ble/protocol/iledcolor/source/graffiti/GraffitiSourceBean.dart';
import '../../ble/protocol/iledcolor/source/text/TextSourceBean.dart';
import 'ShowGifSourceWidget.dart';
import 'ShowGraffitiSourceWidget.dart';
import 'ShowTextSourceWidget.dart';

class ShowSourceWidget extends StatelessWidget {
  final SourceInterface source;

  const ShowSourceWidget({super.key, required this.source});

  @override
  Widget build(BuildContext context) {
    if (source.sourceType == SourceType.TYPE_GRAFFITI) {
      return ShowGraffitiSourceWidget(sourceBean: source as GraffitiSourceBean);
    } else if (source.sourceType == SourceType.TYPE_GIF) {
      return ShowGifSourceWidget(sourceBean: source as GifSourceBean);
    } else if (source.sourceType == SourceType.TYPE_TEXT) {
      return ShowTextSourceWidget(sourceBean: source as TextSourceBean);
    }
    return const Placeholder();
  }
}
